package com.strongwell.awe.dao;

import java.util.List;
import java.util.Map;

import com.strongwell.awe.base.dao.BaseDao;
import com.strongwell.awe.model.CmsArticleEntity;
import org.apache.ibatis.annotations.Select;

/**
 * 文章表
 * 
 * @author bridgezn
 * @email 39440421@qq.com
 * @date 2018-09-13 23:19:26
 */
public interface CmsArticleDao extends BaseDao<CmsArticleEntity> {
    CmsArticleEntity queryName(String name);
    List<CmsArticleEntity> queryListItem(Map<String, Object> map);

    @Select("select * from cms_article \n" +
            "where isnull(delete_time) \n" +
            "and ( category_id=16 or category_id=17 or category_id=25) \n" +
            "order by weight desc limit  #{num}")
    List<CmsArticleEntity> queryArticleList(int num);

    List<CmsArticleEntity> queryListInfo(Map<String, Object> map);

    @Select("select a.id,a.title,a.content,a.copyfrom,a.description,a.hits,a.image,a.keywords,"+
            "a.remarks,a.weight,a.create_time as createTime,b.name as name  from cms_article a \n" +
            "left join cms_category    b on b.id = a.category_id\n" +
            "where isnull(a.delete_time) and b.parent_id>1 and b.module = #{module}\n" +
            "order by a.weight")
    List<CmsArticleEntity> queryArticle(String module);
}
